package com.jobcn.config;

import org.hibernate.boot.model.naming.Identifier;
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy;

/**
 * Spring data jpa对于表名会自动转换成小写，需要此类做手动转换
 * Created by winson on 17-7-6.
 */
public class MySQLUpperCaseStrategy extends SpringPhysicalNamingStrategy {
    private static final long serialVersionUID = 1383021413247872469L;

    @Override
    public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment context) {
        //将小写表名转换为大写表名
        return Identifier.toIdentifier(name.getText(), name.isQuoted());
    }
}